'Procedures Requirement Script  
Option Strict Off
imports System
imports System.Collections
imports PHSRAG.Insight21.Humans
imports PHSRAG.Insight21.BusinessObjects
imports FormsManagement = PHSRAG.Insight21.FormsManagement
imports CDS = PHSRAG.Insight21.CDS

module Script
sub Main()

    Dim procTitle as string = questAnswer.GetAnswerValue("ProcTitle")
    if procTitle <> "" then
        questAnswer.Name = questAnswer.GetAnswerValue("ProcTitle")
        questAnswer.Save( connectionString )
    end if
    
    ' Set the answer to proc on the std app to checked, since we're running req script here
    for each qa as FormsManagement.QuestionnaireAnswer in currentProtVersion.QuestionnaireAnswers
        if qa.Name = "Standard Application" then
            Dim nonSxAnswers as ArrayList = qa.GetAnswers("NonSx")
            if nonSxAnswers.Count > 0 then
                nonSxAnswers(0).Value = "Proc"
            else
				dim answer as new FormsManagement.Answer(cachePolicy)
				answer.Name = "NonSx"
				answer.Value = "Proc"
				answer.QuestionnaireAnswerId = qa.Id
				qa.Answers.Add(answer)
			end if
			qa.Save(connectionString)
        end if
    next
end sub  
end module